package javase.day05;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
/***
 * Byte数组输入输出流
 *		内存中拷贝数组
 */
public class Demo5 {
	public static void main(String[] args) throws IOException {
		byte[] buf = {0x41,0x42,0x46};
		ByteArrayInputStream in = new ByteArrayInputStream(buf);
		int b = in.read();
		b=in.read();
		System.out.println(b);
		in.close();
		
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		out.write(10);
		out.write(20);
		out.write(20);
		out.close();
		byte[] ary = out.toByteArray();
		System.out.println(Arrays.toString(ary));
	}
}
